<h1>Тоглолтууд</h1>

<?php echo link_to('жагсаалт', 'match/index', array('class'=>'title'))?> 
<span class="separator"> | </span>
<?php echo link_to('шинээр нэмэх', 'match/new', array('class'=>'title'))?>
<br clear="all">
<br clear="all">


<table width="100%">
  <thead>
    <tr>
      <th>#</th> 
      <th>Тоглолтын Өдөр</th>       
      <th>Эзэн баг</th>      
      <th>Зочин баг</th>
      <th>Тайлбар</th>
      <th>Нийтэлсэн</th>
      <th>Нэмэлт Цаг</th>      
	    <th>Тоголсон Эсэх</th>      
      <th>Огноо</th>      
      <th>Заал</th>    
	  <th></th>	  
    </tr>
  </thead>
  <tbody>
    <?php $i=0;  foreach ($pager->getResults() as $bb_match): ?>
    <tr>
      <td><?php echo ++$i?></td>
      <td><?php echo $bb_match->getBbMatchday() ?></td>
      <td valign="bottom">
          <b><?php echo $team1 = $bb_match->getBbTeams() ?></b><br>
          <?php echo image_tag('/uploads/team/'.$team1->getDefImg(), array('width'=>40)) ?><br>
          <table>
            <tr>
                <th>1р үе</th>
                <th>2р үе</th>
                <th>3р үе</th>
                <th>4р үе</th>
                <th>Оноо</th>
            </tr>
            <tr>
                <td><?php echo $bb_match->getRound1Score1() ?></td>
            	  <td><?php echo $bb_match->getRound2Score1() ?></td>
            	  <td><?php echo $bb_match->getRound3Score1() ?></td>
            	  <td><?php echo $bb_match->getRound4Score1() ?></td>
            	  <td><?php echo $bb_match->getScore1() ?></td>	  
            </tr>
          </table>
      </td>  	  
      <td valign="bottom">
          <b><?php echo $team2 = $bb_match->getBbTeams_2() ?></b><br>
          <?php echo image_tag('/uploads/team/'.$team2->getDefImg(), array('width'=>40)) ?>
          <table>
            <tr>
                <th>1р үе</th>
                <th>2р үе</th>
                <th>3р үе</th>
                <th>4р үе</th>
                <th>Оноо</th>
            </tr>
            <tr>
                <td><?php echo $bb_match->getRound1Score2() ?></td>
            	  <td><?php echo $bb_match->getRound2Score2() ?></td>
            	  <td><?php echo $bb_match->getRound3Score2() ?></td>
            	  <td><?php echo $bb_match->getRound4Score2() ?></td>
            	  <td><?php echo $bb_match->getScore2() ?></td>
            </tr>
          </table>
      </td>
      <td><?php echo $bb_match->getMatchDescr() ?></td>
      <td><?php echo $bb_match->getPublished() ?></td>
      <td><?php echo $bb_match->getIsExtra() ?></td>
      <td><?php echo $bb_match->getMPlayed() ?></td>
      <td><?php echo $bb_match->getMDate() ?></td>      
      <td><?php echo $bb_match->getMLocation() ?></td>
	  <td nowrap>
	    <a href="<?php echo url_for('playerstat/index?matchId='.$bb_match->getId()) ?>">Стат удирдах</a><br><br>
      <a href="<?php echo url_for('match/edit?id='.$bb_match->getId()) ?>">Засварлах</a><br><br>
      <a onclick="return confirm('Та итгэлтэй байна уу?')" href="<?php echo url_for('match/delete?id='.$bb_match->getId()) ?>">Устгах</a>
    </td>
    <!--
	  <td><?php echo $bb_match->getMId() ?></td>
	  <td><?php echo $bb_match->getMTime() ?></td>
	  <td><?php echo $bb_match->getBonus1() ?></td>
    <td><?php echo $bb_match->getBonus2() ?></td>
	  -->
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>

<?php echo pager($pager, 'match/index')?>